Skip to content

Miscellaneous improvements related to durable task hub #4641

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

MicroFish91
Copy link
Contributor

@MicroFish91 MicroFish91 commented Aug 7, 2025

Summary:

  • Improve how the task hub shows up in the tree view (Add DTS hub icon & show scheduler name as part of the label)
image
  • Assign DTS role to the task hub instead of the scheduler (principle of least privilege)
  • Move role assignment logic from scheduler list step to task hub list step
  • Don't add new role if the parent resource has the role already
  • Consolidate / add an activity child during the role assignment callback so users can see which managed identity has the role if it already exists

@MicroFish91 MicroFish91 requested a review from a team as a code owner August 7, 2025 23:53
@MicroFish91 MicroFish91 changed the title Only provide DTS contributor role to the task hub. Fix how the tax hub shows up under roles in the view Only provide DTS contributor role to the task hub. Fix how the task hub shows up under roles in the view Aug 7, 2025
@MicroFish91 MicroFish91 changed the title Only provide DTS contributor role to the task hub. Fix how the task hub shows up under roles in the view Only provide DTS contributor role to the task hub. Improve how the task hub shows in the tree view Aug 8, 2025
@MicroFish91 MicroFish91 changed the title Only provide DTS contributor role to the task hub. Improve how the task hub shows in the tree view Miscellaneous improvements related to setting up the Durable Task Hub Aug 10, 2025
@MicroFish91 MicroFish91 changed the title Miscellaneous improvements related to setting up the Durable Task Hub Miscellaneous improvements related to Durable Task Hub Aug 10, 2025
@MicroFish91 MicroFish91 force-pushed the mwf/durable-feedback branch from 1af8e52 to 001ac6b Compare August 11, 2025 18:29
Copy link
Member

@nturinski nturinski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignore this. Messing with some testing.

Copy link
Member

@nturinski nturinski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This got worse somehow.

@MicroFish91
Copy link
Contributor Author

Different model?

@nturinski
Copy link
Member

nturinski commented Aug 11, 2025

Yeah, GPT-5 but also running off a prompt.markdown with some more specific instructions. I'm tweaking some of the priorities for reviewing.

Comment on lines 12 to 16

export class DTSStartingResourcesLogStep<T extends IDTSAzureConnectionWizardContext> extends AzureWizardPromptStep<T> {
public hideStepCount: boolean = true;
protected hasLogged: boolean = false;

public async configureBeforePrompt(context: T): Promise<void> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential duplicates after removing guard. Without hasLogged, configureBeforePrompt can prepend items multiple times if the step re-runs (back/forward). Does prependOrInsertAfterLastInfoChild dedupe using stepId? If not, please re-add a guard or enforce deduplication.

Review generated with Copilot

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, but prompt steps will automatically remove activity children by step id when you go back.


promptSteps.push(new FunctionAppUserAssignedIdentitiesListStep(dtsContributorRole /** targetRole */, { identityAssignStepPriority: 180 }));
executeSteps.push(new RoleAssignmentExecuteStep(this.getDTSRoleAssignmentCallback(context, dtsContributorRole), { priority: 190 }));

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Pre-check may skip when creating a new hub. Here scopeId: context.dtsHub?.id (line 78) is undefined during hub creation, so FunctionAppUserAssignedIdentitiesListStep.configureBeforePrompt short-circuits and doesn’t verify an existing identity with the target role. Consider running the pre-check against the scheduler scope first (context.dts.id), or move the pre-check after DurableTaskHubCreateStep so scopeId is available.

Review generated with Copilot

Copy link
Contributor Author

@MicroFish91 MicroFish91 Aug 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This scenario is fine and not a bug. If it's undefined at this time, that means the dtsHub does not currently exist and will be newly created. It will be assigned the role to whichever user assigned identity is chosen. If it doesn't exist yet, there's no reason to check for an existing match so the pre-check is good to skip via the guard clause.

Comment on lines +16 to 22
if (context.managedIdentity) {
context.newDTSConnectionSettingValue = context.newDTSConnectionSettingValue.replace(clientIdKey, context.managedIdentity?.clientId ?? clientIdKey);
}

context.valuesToMask.push(context.newDTSConnectionSettingValue);
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ClientId placeholder may persist. If context.managedIdentity?.clientId is undefined, the replacement keeps the placeholder clientIdKey in the connection string (lines 16-23). Should this step validate a real clientId and fail fast, or is it guaranteed upstream by shouldExecute/flow?

Review generated with Copilot

Copy link
Contributor Author

@MicroFish91 MicroFish91 Aug 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not super worried because the if statement already verifies the managed identity exists. I could throw a nonNull error here if you'd prefer that.

@@ -22,7 +24,7 @@ export class DurableTaskHubListStep<T extends IDTSAzureConnectionWizardContext>

public async prompt(context: T): Promise<void> {
context.dtsHub = (await context.ui.showQuickPick(await this.getPicks(context), {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UX nit: placeholder casing. The placeholder now reads "Select a durable task hub" (line 26). Other pickers often capitalize proper nouns. Consider "Select a Durable Task Hub" for consistency.

Review generated with Copilot

Copy link
Contributor Author

@MicroFish91 MicroFish91 Aug 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I often make these lower case if not prefixed with Azure. If enough people want me to make this upper case, I can do that

@MicroFish91 MicroFish91 changed the title Miscellaneous improvements related to Durable Task Hub Miscellaneous improvements related to durable task hub Aug 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants